/*
 * request_handler.h
 *
 *  Created on: 2021年2月7日
 *      Author: kimfeng
 */

#ifndef CALLBACK_HANDLER_H_
#define CALLBACK_HANDLER_H_

#include "asock_type.h"
#include <map>

typedef int (*CallbackFunction)(const sck_pkg_t *pkg, vec_data_t& data);
class callback_handler
{
public:
	explicit callback_handler();

	void attech_callback_func(const ushort req_num, CallbackFunction f);
	CallbackFunction get_callback_func(const ushort req_num);

private:
	typedef std::map<ushort, CallbackFunction> MapCallbackFunction;
	typedef MapCallbackFunction::iterator MapRequestFunctionItr;
	MapCallbackFunction m_functions;
};

#endif /* CALLBACK_HANDLER_H_ */
